//
//  AddGoodsCell.m
//  reSearchDemo
//
//  Created by 科技 on 15/10/2.
//  Copyright (c) 2015年 Kiwaro. All rights reserved.
//

#import "AddGoodsCell.h"
@interface AddGoodsCell() {
    UILabel *nameLabel;
    UILabel *categoryLabel;
    UILabel *priceLabel;
    UILabel *shelvesLabel;
}

@end

@implementation AddGoodsCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        nameLabel = [[UILabel alloc] init];
        categoryLabel = [[UILabel alloc] init];
        priceLabel = [[UILabel alloc] init];
        shelvesLabel = [[UILabel alloc] init];
        
        [self.contentView addSubview:nameLabel];
        [self.contentView addSubview:categoryLabel];
        [self.contentView addSubview:priceLabel];
        [self.contentView addSubview:shelvesLabel];
    }
    
    return self;
}

- (void)setModel:(NSMutableDictionary *)model {
    nameLabel.frame = CGRectMake(0, 10, CGRectGetWidth(self.frame)/4, 20);
    nameLabel.text = model[@"name"];
    nameLabel.textAlignment = NSTextAlignmentCenter;

    categoryLabel.frame = CGRectMake(CGRectGetWidth(self.frame)/4, 10, CGRectGetWidth(self.frame)/4, 20);
    categoryLabel.text = model[@"category"];
    categoryLabel.textAlignment = NSTextAlignmentCenter;
    
    priceLabel.frame = CGRectMake(CGRectGetWidth(self.frame)/4*2, 10, CGRectGetWidth(self.frame)/4, 20);
    priceLabel.text = model[@"price"];
    priceLabel.textAlignment = NSTextAlignmentCenter;
    
    shelvesLabel.frame = CGRectMake(CGRectGetWidth(self.frame)/4*3, 10, CGRectGetWidth(self.frame)/4, 20);
    shelvesLabel.text = model[@"shelves"];
    shelvesLabel.textAlignment = NSTextAlignmentCenter;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
